// get all DSL config http://jenkins.sunhao.devopscamp.us/plugin/job-dsl/api-viewer/index.html
multibranchPipelineJob("${name}") {
    displayName("${name}")
    branchSources {
        branchSource {
            source {
                git {
                    id('gitee')              
                    remote("https://gitee.com/jnshao/vote-app.git")
                    credentialsId('gitee-pull-secret')

                    traits {
                        // 发现分支功能，创建多分支流水线
                        gitBranchDiscovery()
                        gitHubBranchDiscovery {
                            strategyId(1)
                        }
                        gitHubPullRequestDiscovery {
                            strategyId(2)
                        }
                    }
                }
            }
        }
        triggers {
            computedFolderWebHookTrigger {
                token('vote-token')
            }
            periodicFolderTrigger {
                interval('1m')
            }
        }
        factory {
            workflowBranchProjectFactory {
                scriptPath("${jenkinsfile}")
            }
        }
    }
}